package com.ssm.blog.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ssm.blog.dao.DiaryDAO;
import com.ssm.blog.pojo.Diary;
import com.ssm.blog.service.DiaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DiaryServiceImpl implements DiaryService {
    @Autowired
    private DiaryDAO diaryDAO;

    @Override
    public PageInfo<Diary> getDiaryList(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize, "id desc");
        List<Diary> diaryList = diaryDAO.getDiaryList();
        PageInfo<Diary> pageInfo = new PageInfo<>(diaryList);
        return pageInfo;
    }
}
